const path = require("path");

function resolve(dir) {
    return path.join(__dirname, dir);
}


module.exports = {
    devServer: {
        open: true,
        proxy: {
            '^/api1': {
                target: 'http://192.168.113.249:8081',
                pathRewrite: {
                    '^/api1': ''
                }
            },

            // http://localhost:8080/cms/products/recommend
            '^/cms': {
                //http://192.168.113.249:8081/cms/products/recommend
                //http://192.168.113.249:8081/a/products/recommend
                target: 'http://192.168.113.249:8081', // 转发的目标服务器和端口
                // 重写资源路径
                // pathRewrite: {
                //     '^/cms': '/a'
                // }
                // ws: true,
                // changeOrigin: true
            },
            // '/foo': {
            //     target: '<other_url>'
            // }
        }
    }
}